﻿using System.Runtime.InteropServices;

namespace web.Models
{
    [StructLayout(LayoutKind.Sequential)]
    public struct Shoe
    {
        public int id;

        [MarshalAs(UnmanagedType.BStr)]
        public string color;

        public double size;

        [MarshalAs(UnmanagedType.BStr)]
        public string brand;

        public bool sold;

        [DllImport("lib.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern Shoe CreateShoe();

        [DllImport("lib.dll", CallingConvention = CallingConvention.Cdecl)]
        private static extern void BuyShoe(Shoe shoe);

        public void Buy()
        {
            BuyShoe(this);
        }
    }
}
